/**
 * Copyright 2007-2008. Chongqing First Information & Network Co., Ltd. All rights reserved.
 * <a>http://www.cqfirst.com.cn</a>
 */
package com.cqcis.uip.base.impl;

import com.cqcis.uip.base.UipServer;

/**
 * @author huangmy
 * @date 2007-11-23
 */
public abstract class AbstractUipServer extends BaseUipInterface implements UipServer {
	private long port; /* 服务端监听端口 */
	private String protocol; /* 协议 */
	private boolean keeplive; /* 是否长连接 */

	/**
	 * (non-Javadoc)
	 * 
	 * @see com.cqcis.uip.base.UipServer#getPort()
	 */
	public long getPort() {
		return port;
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see com.cqcis.uip.base.UipServer#getProtocol()
	 */
	public String getProtocol() {
		return protocol;
	}

	/**
	 * (non-Javadoc)
	 * 
	 * @see com.cqcis.uip.base.UipServer#getSessions()
	 */
	public abstract String[] getSessions();

	/**
	 * (non-Javadoc)
	 * 
	 * @see com.cqcis.uip.base.UipServer#isKeeplive()
	 */
	public boolean isKeeplive() {
		return keeplive;
	}

	/**
	 * @param port
	 */
	public void setPort(long port) {
		this.port = port;
	}

	/**
	 * @param protocol
	 */
	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	/**
	 * @param keeplive
	 */
	public void setKeeplive(boolean keeplive) {
		this.keeplive = keeplive;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new StringBuffer().append("name:" + this.getName()).append(" protocol:" + this.protocol).append(
				" port:" + this.port).append(" keeplive:" + this.keeplive).append(" running:" + this.isRunning())
				.append(" startTime:" + this.getStartTime()).append(" doneCount:" + this.getDoneCount()).append(
						" errorCount:" + this.getErrorCount())/* .append(" sessions:" + this.getSessions()) */.append(
						" properties:" + this.getProperties()).toString();
	}
}
